﻿using LxCore;


namespace LxCore
{
    public class FvBoundList : JsIdentifyList<FvBound>
    {
        public override void Add(FvBound item)
        {
            base.Add(item);
            if (isSimMesh(item))
            {
                LxSim.Sim.Conditions.ZoneConds[item.InZone.ID].BoundConds.Add(new BoundCond(item));
            }
        }
        public override void Insert(int index, FvBound item)
        {
            base.Insert(index, item);
            if (isSimMesh(item))
            {
                LxSim.Sim.Conditions.ZoneConds[item.InZone.ID].BoundConds.Insert(index, new BoundCond(item));
            }
        }
        public override void RemoveAt(int index)
        {
            base.RemoveAt(index);
            throw new NotImplementedException();
        }
        public override bool Remove(FvBound item)
        {
            throw new NotImplementedException();
            return base.Remove(item);

        }
        public override void Clear()
        {
            base.Clear();
            throw new NotImplementedException();
        }
        protected bool isSimMesh(FvBound item)
        {
            int zoneid = item.InZone.ID;
            if (zoneid < LxSim.Sim.Mesh.Zones.Count)
            {
                return (ReferenceEquals(item.InZone, LxSim.Sim.Mesh.Zones[zoneid]));
            }
            return false;
        }
    }
}

